package com.mdd.front.controller.yangyangLeadingEnterprise.index;

import com.mdd.common.aop.NotLogin;
import com.mdd.common.entity.yangyangLeadingEnterprise.TAppReport;
import com.mdd.common.entity.yangyangLeadingEnterprise.TAppUser;
import com.mdd.common.entity.yangyangLeadingEnterprise.common.JsonReturn;
import com.mdd.common.entity.yangyangLeadingEnterprise.param.CommonParam;
import com.mdd.common.entity.yangyangLeadingEnterprise.param.ReportAuthorizationLinkParam;
import com.mdd.front.service.yangyangLeadingEnterprise.ITAppReportService;
import com.mdd.front.service.yangyangLeadingEnterprise.ITAppUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@RequestMapping("/api/index/report")
@Api(tags = "财税报告管理")
public class TAppReportController {

    @Resource
    ITAppReportService appReportService;

    @Resource
    ITAppUserService appUserService;

    @NotLogin
    @PostMapping("/selectList")
    @ApiOperation(value="财税报告删除")
    @ResponseBody
    public String selectList(HttpServletRequest request) {
        List<TAppReport> appReportList = appReportService.selectList();
        return JsonReturn.success().setListData(appReportList).toJsonStr();
    }

    @NotLogin
    @PostMapping("/reportAuthorizationLink")
    @ApiOperation(value="获取报告授权链接")
    @ResponseBody
    public String reportAuthorizationLink(@RequestBody ReportAuthorizationLinkParam param, HttpServletRequest request) {
        return appReportService.reportAuthorizationLink(param);
    }

    @NotLogin
    @PostMapping("/preLoanReportAuthorizationLink")
    @ApiOperation(value="获取贷前报告授权链接")
    @ResponseBody
    public String preLoanReportAuthorizationLink(@RequestBody ReportAuthorizationLinkParam param, HttpServletRequest request) {
        return appReportService.preLoanReportAuthorizationLink(param);
    }

    @NotLogin
    @PostMapping("/createReport")
    @ApiOperation(value="生成报告")
    @ResponseBody
    public String createReport(@RequestBody ReportAuthorizationLinkParam param, HttpServletRequest request) {
        return appReportService.createReport(param);
    }

}
